define(backboneCommon.getControllerDefine("AdSpace"), function (require,Model,ModelBaseData,ModelMedia,ModelTemplate) {
    var model=new Model();
    var modelBaseData=new ModelBaseData();
    var modelMedia=new ModelMedia();
    var modelTemplate=new ModelTemplate();
    return Backbone.Collection.extend({
        model:  model,
        initialize: function () {
            model.set({modelBaseData:modelBaseData});
            model.set({modelMedia:modelMedia});
            model.set({modelTemplate:modelTemplate});
        },
        List:function(){
            modelBaseData.getAdFormat();
            modelBaseData.getOs();
            modelMedia.getDropDownList();
        },
        Detail:function(param){
            var id=param?param[0]:null;
            model.getInfo(id);
        },
        initDetailAfter:function (json) {
            modelBaseData.getAdFormat();
            modelBaseData.getRatio();
            modelBaseData.getImageType();
            modelMedia.getDropDownList();
        },
        getPageList:function(param){
            model.getPageList(param);
        },
        getTemplateList:function (param) {
            modelTemplate.getDropDownList(param);
        },
        operateDelete:function(id){
            model.deleteInfo(id);
        },
        saveInfo: function (json) {
            json.id?model.updateInfo(json):model.addInfo(json);
        },
        updateStatus: function (param) {
            model.updateStatus(param);
        }
    });
});